<?php
include "Mailer/class.phpmailer.php";
class IO_Mailer
{

	function send_mail($p_strFromName,$p_strToEmail,$cc='',$bcc='',$p_strSubject,$p_strContent,$p_strFromEmail='')
		{
			$objMail = new PHPMailer();
			$objMail->IsSMTP();                            // send via SMTP
			$objMail->Host     = "mail.boniva-shopping.com";   // SMTP servers
			$objMail->SMTPAuth = true;     			    // turn on SMTP authentication
			$objMail->Username = "info@boniva-shopping.com"; // SMTP username
			$objMail->Password = "1qaz@WSX"; // SMTP password
		
			if($p_strFromEmail!='')
				$objMail->From = $p_strFromEmail;				// From E-mail
			$objMail->FromName = $p_strFromName;				// From Name
		
		
			$objMail->AddAddress($p_strToEmail); 				// To E-mail
			if($cc!='')								// CC
				$objMail->AddAddress($cc);
			if($bcc!='')							//BCC
				$objMail->AddAddress($bcc);
			$objMail->WordWrap = 50;                   // set word wrap
			$objMail->IsHTML(true);                    // send as HTML
		
			$objMail->Subject  =  $p_strSubject;
			$objMail->Body     =  $p_strContent;
		
			return $objMail->Send();
		}
		
		function utf_to_iso8859_1($string)
		{
			if ( ! ereg("[\241-\377]", $string) )
				return $string;
	
			$iso8859_11 = array(
			"á" =>"&aacute;",
			"à" =>"&agrave;",
			"ã" =>"&atilde;",
			"ả" =>"&#7843;",
			"ạ" =>"&#7841;",
			"ă" =>"&#259;",
			"ắ" =>"&#7855;",
			"ằ" =>"&#7857;",
			"ẳ" =>"&#7859;",
			"ẵ" =>"&#7861;",
			"ặ" =>"&#7863;",
			"â" =>"&acirc;",
			"ấ" =>"&#7845;",
			"ầ" =>"&#7847;",
			"ẩ" =>"&#7849;",
			"ẫ" =>"&#7851;",
			"ậ" =>"&#7853;",
			"é"=>"&eacute;",
			"è"=>"&egrave;",
			"ẻ"=>"&#7867;",
			"ẽ"=>"&#7869;",
			"ẹ"=>"&#7865;",
			"ê"=>"&ecirc;",
			"ế"=>"&#7871;",
			"ề"=>"&#7873;",
			"ể"=>"&#7875;",
			"ễ"=>"&#7877;",
			"ệ"=>"&#7879;",
			"í"=>"&iacute;",
			"ì"=>"&igrave;",
			"ỉ"=>"&#7881;",
			"ĩ"=>"&#297;",
			"ị"=>"&#7883;",
			"ó"=>"&oacute;",
			"ò"=>"&ograve;",
			"ỏ"=>"&#7887;",
			"õ"=>"&otilde;",
			"ọ"=>"&#7885;",
			"ố"=>"&#7889;",
			"ồ"=>"&#7891;",
			"ổ"=>"&#7893;",
			"ỗ"=>"&#7895;",
			"ộ"=>"&#7897;",
			"ớ"=>"&#7899;",
			"ờ"=>"&#7901;",
			"ở"=>"&#7903;",
			"ỡ"=>"&#7905;",
			"ợ"=>"&#7907;",
			"ú"=>"&uacute;",
			"ù"=>"&ugrave;",
			"ủ"=>"&#7911;",
			"ũ"=>"&#361;",
			"ụ"=>"&#7909;",
			"ứ"=>"&#7913;",
			"ừ"=>"&#7915;",
			"ử"=>"&#7917;",
			"ữ"=>"&#7919;",
			"ự"=>"&#7921;",
			"đ"=>"&#273;",
			"ô"=>"&ocirc;",
			"â"=>"&acirc;",
			"ư"=>"&#432;",
			"“"=>"&ldquo;",
			"”"=>"&rdquo;",
			"ý"=>"&yacute;",
			"ỹ"=>"&#7929;",
		
			"ơ"=>"&#417;",
			"Á"=>"&Aacute;",
			"À"=>"&Agrave;",
			"Ã"=>"&Atilde;",
			"Ả"=>"&#7842;",
			"Ạ"=>"&#7840;",
			"Ă"=>"&#258;",
			"Ắ"=>"&#7854;",
			"Ằ"=>"&#7856;",
			"Ẳ"=>"&#7858;",
			"Ẵ"=>"&#7860;",
			"Ặ"=>"&#7862;",
			"Ấ"=>"&#7844;",
			"Ầ"=>"&#7846;",
			"Ẩ"=>"&#7848;",
			"Ẫ"=>"&#7850;",
			"Ậ"=>"&#7852;",
			"É"=>"&Eacute;",
			"È"=>"&Egrave;",
			"Ẻ"=>"&#7866;",
			"Ẽ"=>"&#7868;",
			"Ẹ"=>"&#7864;",
			"Ê"=>"&Ecirc;",
			"Ế"=>"&#7870;",
			"Ề"=>"&#7872;",
			"Ể"=>"&#7874;",
			"Ễ"=>"&#7876;",
			"Ệ"=>"&#7878;",
			"Í"=>"&Iacute;",
			"Ì"=>"&Igrave;",
			"Ỉ"=>"&#7880;",
			"Ĩ"=>"&#296;",
			"Ị"=>"&#7882;",
			"Ó"=>"&Oacute;",
			"Ò"=>"&Ograve;",
			"Ỏ"=>"&#7886;",
			"Õ"=>"&Otilde;",
			"Ọ"=>"&#7884;",
			"Ố"=>"&#7888;",
			"Ồ"=>"&#7890;",
			"Ổ"=>"&#7892;",
			"Ỗ"=>"&#7894;",
			"Ộ"=>"&#7896;",
			"Ớ"=>"&#7898;",
			"Ờ"=>"&#7900;",
			"Ở"=>"&#7902;",
			"Ỡ"=>"&#7904;",
			"Ợ"=>"&#7906;",
			"Ú"=>"&Uacute;",
			"Ù"=>"&Ugrave;",
			"Ủ"=>"&#7910;",
			"Ũ"=>"&#360;",
			"Ụ"=>"&#7908;",
			"Ứ"=>"&#7912;",
			"Ừ"=>"&#7914;",
			"Ử"=>"&#7916;",
			"Ữ"=>"&#7918;",
			"Ự"=>"&#7920;",
			"Đ"=>"&#272;",
			"Ô"=>"&Ocirc;",
			"Â"=>"&Acirc;",
			"Ư"=>"&#431;",
			"Ý"=>"&Yacute;",
			"Ỹ"=>"&#7928;",
			"Ơ"=>"&#416;"
			 );
			 $string=strtr($string,$iso8859_11);
			 return $string;
		}
	
	function getExtFile($p_strFile)
	{
		return strtolower(substr(strrchr($p_strFile, "." ),1));
	}
	static function mkStrNotSign($p_str)
	{
		$str = trim($p_str);
		$str = preg_replace('/\s\s+/', ' ', $str);
		$str = preg_replace("/(à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)/", 'a', $str);
		$str = preg_replace("/(è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ)/", 'e', $str);
		$str = preg_replace("/(ì|í|ị|ỉ|ĩ)/", 'i', $str);
		$str = preg_replace("/(ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ)/", 'o', $str);
		$str = preg_replace("/(ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ)/", 'u', $str);
		$str = preg_replace("/(ỳ|ý|ỵ|ỷ|ỹ)/", 'y', $str);
		$str = preg_replace("/(đ)/", 'd', $str);
		$str = preg_replace("/(À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ)/", 'A', $str);
		$str = preg_replace("/(È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ)/", 'E', $str);
		$str = preg_replace("/(Ì|Í|Ị|Ỉ|Ĩ)/", 'I', $str);
		$str = preg_replace("/(Ò|Ó|Ọ|Ỏ|Õ|Ô|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ)/", 'O', $str);
		$str = preg_replace("/(Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ)/", 'U', $str);
		$str = preg_replace("/(Ỳ|Ý|Ỵ|Ỷ|Ỹ)/", 'Y', $str);
		$str = preg_replace("/(Đ)/", 'D', $str);
		
		$strReturn = '';
		for( $i = 0; $i <= strlen($str); $i++ )
		{
			if ( preg_match('/^[a-zA-Z0-9\-\,]$/i', substr($str, $i, 1)) )
				$strReturn .= substr($str, $i, 1);
			elseif ( substr($str, $i, 1) == ' ' )
				$strReturn .= ' ';
		}
		return $strReturn;
	}
}
?>